import { IPSLanguageRes } from './ipslanguage-res';
import { IPSSysCss } from './ipssys-css';
import { IPSSysImage } from './ipssys-image';
import { IPSSysPFPlugin } from './ipssys-pfplugin';
import { IPSSysPortlet } from './ipssys-portlet';
import { IPSSysUniRes } from '../security/ipssys-uni-res';
import { PSModelObjectImpl } from '../psmodel-object-impl';

export class PSSysPortletImpl extends PSModelObjectImpl implements IPSSysPortlet {
  get actionGroupExtractMode(): 'ITEM' | 'ITEMS' {
    return this.M.actionGroupExtractMode;
  }

  get codeName(): string {
    return this.M.codeName;
  }

  get dynaModelFilePath(): string {
    return this.M.dynaModelFilePath;
  }

  get emptyText(): string {
    return this.M.emptyText;
  }

  protected emptytextpslanguageres: IPSLanguageRes | null = null;

  getEmptyTextPSLanguageRes(): IPSLanguageRes | null {
    if (this.emptytextpslanguageres != null) return this.emptytextpslanguageres;
    const value = this.M.getEmptyTextPSLanguageRes;
    if (value == null) {
      return null;
    }
    this.emptytextpslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getEmptyTextPSLanguageRes') as IPSLanguageRes;
    return this.emptytextpslanguageres;
  }

  get emptyTextPSLanguageRes(): IPSLanguageRes | null {
    return this.getEmptyTextPSLanguageRes();
  }

  getEmptyTextPSLanguageResMust(): IPSLanguageRes {
    const value = this.getEmptyTextPSLanguageRes();
    if (value == null) {
      throw new Error('未指定空白内容语言资源');
    }
    return value;
  }

  get height(): number {
    return this.M.height;
  }

  get memo(): string {
    return this.M.memo;
  }

  get name(): string {
    return this.M.name;
  }

  protected pssyscss: IPSSysCss | null = null;

  getPSSysCss(): IPSSysCss | null {
    if (this.pssyscss != null) return this.pssyscss;
    const value = this.M.getPSSysCss;
    if (value == null) {
      return null;
    }
    this.pssyscss = this.getPSModel4('res.IPSSysCss', value, 'getPSSysCss') as IPSSysCss;
    return this.pssyscss;
  }

  get psSysCss(): IPSSysCss | null {
    return this.getPSSysCss();
  }

  getPSSysCssMust(): IPSSysCss {
    const value = this.getPSSysCss();
    if (value == null) {
      throw new Error('未指定系统界面样式表');
    }
    return value;
  }

  protected pssysimage: IPSSysImage | null = null;

  getPSSysImage(): IPSSysImage | null {
    if (this.pssysimage != null) return this.pssysimage;
    const value = this.M.getPSSysImage;
    if (value == null) {
      return null;
    }
    this.pssysimage = this.getPSModel4('res.IPSSysImage', value, 'getPSSysImage') as IPSSysImage;
    return this.pssysimage;
  }

  get psSysImage(): IPSSysImage | null {
    return this.getPSSysImage();
  }

  getPSSysImageMust(): IPSSysImage {
    const value = this.getPSSysImage();
    if (value == null) {
      throw new Error('未指定系统图片');
    }
    return value;
  }

  protected pssyspfplugin: IPSSysPFPlugin | null = null;

  getPSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.pssyspfplugin != null) return this.pssyspfplugin;
    const value = this.M.getPSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.pssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getPSSysPFPlugin') as IPSSysPFPlugin;
    return this.pssyspfplugin;
  }

  get psSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getPSSysPFPlugin();
  }

  getPSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getPSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定前端扩展插件');
    }
    return value;
  }

  protected pssysunires: IPSSysUniRes | null = null;

  getPSSysUniRes(): IPSSysUniRes | null {
    if (this.pssysunires != null) return this.pssysunires;
    const value = this.M.getPSSysUniRes;
    if (value == null) {
      return null;
    }
    this.pssysunires = this.getPSModel4('security.IPSSysUniRes', value, 'getPSSysUniRes') as IPSSysUniRes;
    return this.pssysunires;
  }

  get psSysUniRes(): IPSSysUniRes | null {
    return this.getPSSysUniRes();
  }

  getPSSysUniResMust(): IPSSysUniRes {
    const value = this.getPSSysUniRes();
    if (value == null) {
      throw new Error('未指定系统统一资源');
    }
    return value;
  }

  get portletStyle(): 'DEFAULT' | 'STYLE2' | 'STYLE3' | 'STYLE4' {
    return this.M.portletStyle;
  }

  get portletType(): 'LIST' | 'CHART' | 'VIEW' | 'HTML' | 'TOOLBAR' | 'ACTIONBAR' | 'CUSTOM' {
    return this.M.portletType;
  }

  get reloadTimer(): number {
    return this.M.reloadTimer;
  }

  get templEngine(): string {
    return this.M.templEngine;
  }

  get title(): string {
    return this.M.title;
  }

  protected titlepslanguageres: IPSLanguageRes | null = null;

  getTitlePSLanguageRes(): IPSLanguageRes | null {
    if (this.titlepslanguageres != null) return this.titlepslanguageres;
    const value = this.M.getTitlePSLanguageRes;
    if (value == null) {
      return null;
    }
    this.titlepslanguageres = this.getPSModel4('res.IPSLanguageRes', value, 'getTitlePSLanguageRes') as IPSLanguageRes;
    return this.titlepslanguageres;
  }

  get titlePSLanguageRes(): IPSLanguageRes | null {
    return this.getTitlePSLanguageRes();
  }

  getTitlePSLanguageResMust(): IPSLanguageRes {
    const value = this.getTitlePSLanguageRes();
    if (value == null) {
      throw new Error('未指定抬头语言资源对象');
    }
    return value;
  }

  protected titlepssyspfplugin: IPSSysPFPlugin | null = null;

  getTitlePSSysPFPlugin(): IPSSysPFPlugin | null {
    if (this.titlepssyspfplugin != null) return this.titlepssyspfplugin;
    const value = this.M.getTitlePSSysPFPlugin;
    if (value == null) {
      return null;
    }
    this.titlepssyspfplugin = this.getPSModel4('res.IPSSysPFPlugin', value, 'getTitlePSSysPFPlugin') as IPSSysPFPlugin;
    return this.titlepssyspfplugin;
  }

  get titlePSSysPFPlugin(): IPSSysPFPlugin | null {
    return this.getTitlePSSysPFPlugin();
  }

  getTitlePSSysPFPluginMust(): IPSSysPFPlugin {
    const value = this.getTitlePSSysPFPlugin();
    if (value == null) {
      throw new Error('未指定抬头绘制应用插件');
    }
    return value;
  }

  get userCat(): string {
    return this.M.userCat;
  }

  get userTag(): string {
    return this.M.userTag;
  }

  get userTag2(): string {
    return this.M.userTag2;
  }

  get userTag3(): string {
    return this.M.userTag3;
  }

  get userTag4(): string {
    return this.M.userTag4;
  }

  get enableAppDashboard(): boolean {
    return this.M.enableAppDashboard;
  }

  get enableDEDashboard(): boolean {
    return this.M.enableDEDashboard;
  }

  get showTitleBar(): boolean {
    return this.M.showTitleBar;
  }

  get cls(): string {
    return 'PSSysPortletImpl';
  }

  instanceof(cls: string): boolean {
    if (cls == 'res.IPSSysPortlet') return true;
    return super.instanceof(cls);
  }
}
